package com.weitu.threeSimultaneities.safe.service.impl;

import com.weitu.threeSimultaneities.safe.entity.SafeDesign;
import com.weitu.threeSimultaneities.safe.mapper.SafeDesignMapper;
import com.weitu.threeSimultaneities.safe.service.SafeDesignService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

@Service
public class SafeDesignServiceImpl implements SafeDesignService {
    @Autowired
    private SafeDesignMapper safeDesignMapper;

    private static final Logger logger = LoggerFactory.getLogger(SafeDesignServiceImpl.class);

    @Override
    public SafeDesign selectByPrimaryKey(String id) {
        return this.safeDesignMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteBySubjectId(String id) {
        return this.safeDesignMapper.deleteBySubjectId(id);
    }
    @Override
    public int updateByPrimaryKeySelective(Map paramMap) {
        return this.safeDesignMapper.updateByPrimaryKeySelective(paramMap);
    }
    @Override
    @Transactional
    public int insertSelective(Map paramMap) {
        this.safeDesignMapper.deleteBySubjectId(paramMap.get("subjectId").toString());
        return this.safeDesignMapper.insertSelective(paramMap);
    }

    @Override
    public SafeDesign selectBySubjectId(String id) {
        return this.safeDesignMapper.selectBySubjectId(id);
    }
}